<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2016/12/21
 * Time: 13:18
 */

namespace App\Admin\Extensions;

use Encore\Admin\Form\Field;

class WangEditor extends Field
{
    protected $view = 'admin::form.editor';

    protected static $css = [
        '/packages/wangEditor-2.1.22/dist/css/wangEditor.min.css',
    ];

    protected static $js = [
        '/packages/wangEditor-2.1.22/dist/js/wangEditor.min.js',
    ];

    public function render()
    {
        $this->script = <<<EOT

        var editor = new wangEditor('{$this->id}');
            editor.config.zindex = 20000;
            editor.create();
EOT;
        return parent::render();
//        editor.config.uploadImgFileName = 'image';
//        editor.config.uploadImgUrl = '/admin/api/images';
    }
}